home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / weblibev / htmlpabc.inl < prev    next >
Encoding:
Text File  |  1995-10-03  |  6.3 KB  |  205 lines

  1.  
  2. ///////////////////////////////////////////////////////////////////////////////
  3. // Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
  4. // the terms and conditions of the software license agreement.
  5.  
  6. #ifndef __HTMLPABC_INL__
  7. #define __HTMLPABC_INL__
  8.  
  9. ///////////////////////////////////////////////////////////////////////////////
  10. // Inline methods of TWeblibHtmlAPI class.
  11.  
  12. inline TWeblibHtmlAPI::TWeblibHtmlAPI()
  13. {
  14.     m_hParse = NULL;
  15. }
  16.  
  17. inline TWeblibHtmlAPI::TWeblibHtmlAPI(LPCSTR lpszFilename,WORD wOptions)
  18. {
  19.     m_hParse = WLHtmlParseFile(lpszFilename,wOptions);
  20. }
  21.  
  22. inline TWeblibHtmlAPI::TWeblibHtmlAPI(LPCSTR lpszBuf,DWORD cbBuf,WORD wOptions)
  23. {
  24.     if (cbBuf == 0)
  25.         cbBuf = lstrlen(lpszBuf) + sizeof('\0');
  26.     m_hParse = WLHtmlParseBuf(lpszBuf,cbBuf,wOptions);
  27. }
  28.  
  29. inline BOOL TWeblibHtmlAPI::IsGood() const
  30. {
  31.     return m_hParse != NULL;
  32. }
  33.       
  34. inline BOOL TWeblibHtmlAPI::ParseFile(LPCSTR lpszFilename,WORD wOptions)
  35. {
  36.     return (m_hParse = WLHtmlParseFile(lpszFilename,wOptions)) != NULL;
  37. }
  38.  
  39. inline BOOL TWeblibHtmlAPI::ParseBuf(LPCSTR lpszBuf,DWORD cbBuf,WORD wOptions)
  40. {                                 
  41.     if (cbBuf == 0)      
  42.         cbBuf = lstrlen(lpszBuf) + sizeof('\0');
  43.     return (m_hParse = WLHtmlParseBuf(lpszBuf,cbBuf,wOptions)) != NULL;
  44. }
  45.  
  46. inline HELEMENT TWeblibHtmlAPI::GetChild(HELEMENT hElement) const
  47. {
  48.     return m_hParse == NULL ? NULL : WLHtmlGetChild(m_hParse,hElement);
  49. }
  50.  
  51. inline HELEMENT TWeblibHtmlAPI::GetParent(HELEMENT hElement) const
  52. {
  53.     return m_hParse == NULL ? NULL : WLHtmlGetParent(m_hParse,hElement);
  54. }
  55.  
  56. inline HELEMENT TWeblibHtmlAPI::GetSibling(HELEMENT hElement,WORD wRel) const
  57. {
  58.     return m_hParse == NULL ? NULL : WLHtmlGetSibling(m_hParse,hElement,wRel);
  59. }
  60.     
  61. inline UINT TWeblibHtmlAPI::GetElementType(HELEMENT hElement) const
  62. {
  63.     return m_hParse == NULL ? 0 : WLHtmlGetElementType(m_hParse,hElement);
  64. }
  65.  
  66. inline LPCSTR TWeblibHtmlAPI::GetElementText(HELEMENT hElement) const
  67. {
  68.     return m_hParse == NULL ? NULL : WLHtmlGetElementText(m_hParse,hElement);
  69. }
  70.     
  71. inline DWORD TWeblibHtmlAPI::GetTextAttr(HELEMENT hElement) const
  72. {
  73.     return m_hParse == NULL ? 0L : WLHtmlGetTextAttr(m_hParse,hElement);
  74. }
  75.  
  76. inline LPCSTR TWeblibHtmlAPI::GetTagName(HELEMENT hElement) const
  77. {
  78.     return m_hParse == NULL ? NULL : WLHtmlGetTagName(m_hParse,hElement);
  79. }
  80.  
  81. inline UINT TWeblibHtmlAPI::GetTagType(HELEMENT hElement) const
  82. {
  83.     return m_hParse == NULL ? 0 : WLHtmlGetTagType(m_hParse,hElement);
  84. }
  85.     
  86. inline HTAGATTR TWeblibHtmlAPI::GetTagAttr(HELEMENT hElement,HTAGATTR hTagAttr,WORD *pwType,
  87.     LPSTR lpszAttr,UINT cbAttr,LPSTR lpszValue,UINT cbValue) const 
  88.     return m_hParse == NULL ? NULL : WLHtmlGetTagAttr(m_hParse,hElement,hTagAttr,pwType,
  89.         lpszAttr,cbAttr,lpszValue,cbValue); 
  90. }
  91.  
  92. inline LPCSTR TWeblibHtmlAPI::ExtractTagAttr(HELEMENT hElement,LPSTR lpszAttr) const
  93. {
  94.     return m_hParse == NULL ? NULL : WLHtmlExtractTagAttr(m_hParse,hElement,lpszAttr);    
  95. }
  96.         
  97. inline HELEMENT TWeblibHtmlAPI::FindText(HELEMENT hElement,LPCSTR lpszText) const
  98. {
  99.     return m_hParse == NULL ? NULL : WLHtmlFindText(m_hParse,hElement,lpszText);
  100. }
  101.  
  102. inline HELEMENT TWeblibHtmlAPI::FindSpecial(HELEMENT hElement,LPCSTR lpszSpecial) const
  103. {   
  104.     return m_hParse == NULL ? NULL : WLHtmlFindSpecial(m_hParse,hElement,lpszSpecial);
  105. }
  106.  
  107. inline HELEMENT TWeblibHtmlAPI::FindComment(HELEMENT hElement,LPCSTR lpszCommentText) const
  108. {   
  109.     return m_hParse == NULL ? NULL : WLHtmlFindComment(m_hParse,hElement,lpszCommentText);
  110. }
  111.  
  112. inline HELEMENT TWeblibHtmlAPI::FindTagType(HELEMENT hElement,UINT nType) const
  113. {   
  114.     return m_hParse == NULL ? NULL : WLHtmlFindTagType(m_hParse,hElement,nType);
  115. }
  116.  
  117. inline HELEMENT TWeblibHtmlAPI::FindTagName(HELEMENT hElement,LPCSTR lpszTag) const
  118. {   
  119.     return m_hParse == NULL ? NULL : WLHtmlFindTagName(m_hParse,hElement,lpszTag);
  120. }
  121.  
  122. inline HELEMENT TWeblibHtmlAPI::FindTagAttr(HELEMENT hElement,UINT nType,LPCSTR lpszAttr,
  123.     LPCSTR lpszValue) const
  124. {   
  125.     return m_hParse == NULL ? NULL : WLHtmlFindTagAttr(m_hParse,hElement,nType,lpszAttr,lpszValue);
  126. }
  127.  
  128. ///////////////////////////////////////////////////////////////////////////////
  129. // Inline methods of TWeblibHtml class.
  130.  
  131. #ifndef WEBLIB_NO_OWL
  132.  
  133. inline BOOL TWeblibHtml::IsGood() const
  134. {
  135.     return TWeblibHtmlAPI::IsGood() && m_pWindow != NULL && m_pWindow->HWindow != NULL;
  136. }
  137.  
  138. inline BOOL TWeblibHtml::EnumParseTree(UINT nEnumID)
  139. {
  140.     return IsGood() &&
  141.             PushEnumStack(nEnumID) &&
  142.             TWeblibHtmlAPI::EnumParseTree(m_pWindow->HWindow,WM_WEBLIB_ENUMPARSETREE) &&
  143.             PopEnumStack();
  144. }
  145.     
  146. inline BOOL TWeblibHtml::EnumFindText(HELEMENT hElement,LPCSTR lpszText,UINT nEnumID)
  147. {          
  148.     return IsGood() &&
  149.            PushEnumStack(nEnumID) && 
  150.            TWeblibHtmlAPI::EnumFindText(hElement,lpszText,m_pWindow->HWindow,
  151.                  WM_WEBLIB_ENUMFINDTEXT) &&
  152.             PopEnumStack();
  153. }
  154.  
  155. inline BOOL TWeblibHtml::EnumFindSpecial(HELEMENT hElement,LPCSTR lpszSpecial,UINT nEnumID)
  156. {
  157.     return IsGood() &&
  158.             PushEnumStack(nEnumID) &&
  159.             TWeblibHtmlAPI::EnumFindSpecial(hElement,lpszSpecial,m_pWindow->HWindow,
  160.                  WM_WEBLIB_ENUMFINDSPEC) &&
  161.             PopEnumStack();
  162. }
  163.     
  164. inline BOOL TWeblibHtml::EnumFindComment(HELEMENT hElement,LPCSTR lpszComment,UINT nEnumID)
  165. {   
  166.     return IsGood() &&
  167.            PushEnumStack(nEnumID) && 
  168.            TWeblibHtmlAPI::EnumFindComment(hElement,lpszComment,m_pWindow->HWindow,
  169.                WM_WEBLIB_ENUMFINDCOMM) &&
  170.            PopEnumStack();
  171. }
  172.     
  173. inline BOOL TWeblibHtml::EnumFindTagType(HELEMENT hElement,UINT nType,UINT nEnumID)
  174. {
  175.     return IsGood() &&
  176.            PushEnumStack(nEnumID) && 
  177.            TWeblibHtmlAPI::EnumFindTagType(hElement,nType,m_pWindow->HWindow,
  178.                WM_WEBLIB_ENUMFINDTAGTYPE) &&
  179.            PopEnumStack();
  180. }
  181.     
  182. inline BOOL TWeblibHtml::EnumFindTagName(HELEMENT hElement,LPCSTR lpszTag,UINT nEnumID)
  183. {   
  184.     return IsGood() &&
  185.             PushEnumStack(nEnumID) &&
  186.            TWeblibHtmlAPI::EnumFindTagName(hElement,lpszTag,m_pWindow->HWindow,
  187.                WM_WEBLIB_ENUMFINDTAGNAME) &&
  188.            PopEnumStack();
  189. }
  190.     
  191. inline BOOL TWeblibHtml::EnumFindTagAttr(HELEMENT hElement,UINT nType,LPCSTR lpszAttr,
  192.     LPCSTR lpszValueText,UINT nEnumID)
  193. {   
  194.     return IsGood() &&
  195.            PushEnumStack(nEnumID) && 
  196.             TWeblibHtmlAPI::EnumFindTagAttr(hElement,nType,lpszAttr,lpszValueText,
  197.                  m_pWindow->HWindow,WM_WEBLIB_ENUMFINDTAGATTR) &&
  198.            PopEnumStack();
  199. }
  200.  
  201. #endif    // WEBLIB_NO_OWL
  202.  
  203. #endif
  204.